/// name : "John Smith"
/// email : "john@example.com"
/// mother : {"name":"Alice","email":"alice@example.com"}
/// friends : [{"name":"Jack","email":"Jack@example.com"},{"name":"Nancy","email":"Nancy@example.com"}]

class User4 {
  String _name;
  String _email;
  Mother _mother;
  List<Friends> _friends;

  String get name => _name;
  String get email => _email;
  Mother get mother => _mother;
  List<Friends> get friends => _friends;

  User4({
      String name, 
      String email, 
      Mother mother, 
      List<Friends> friends}){
    _name = name;
    _email = email;
    _mother = mother;
    _friends = friends;
}

  User4.fromJson(dynamic json) {
    _name = json["name"];
    _email = json["email"];
    _mother = json["mother"] != null ? Mother.fromJson(json["mother"]) : null;
    if (json["friends"] != null) {
      _friends = [];
      json["friends"].forEach((v) {
        _friends.add(Friends.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    var map = <String, dynamic>{};
    map["name"] = _name;
    map["email"] = _email;
    if (_mother != null) {
      map["mother"] = _mother.toJson();
    }
    if (_friends != null) {
      map["friends"] = _friends.map((v) => v.toJson()).toList();
    }
    return map;
  }

}

/// name : "Jack"
/// email : "Jack@example.com"

class Friends {
  String _name;
  String _email;

  String get name => _name;
  String get email => _email;

  Friends({
      String name, 
      String email}){
    _name = name;
    _email = email;
}

  Friends.fromJson(dynamic json) {
    _name = json["name"];
    _email = json["email"];
  }

  Map<String, dynamic> toJson() {
    var map = <String, dynamic>{};
    map["name"] = _name;
    map["email"] = _email;
    return map;
  }

}

/// name : "Alice"
/// email : "alice@example.com"

class Mother {
  String _name;
  String _email;

  String get name => _name;
  String get email => _email;

  Mother({
      String name, 
      String email}){
    _name = name;
    _email = email;
}

  Mother.fromJson(dynamic json) {
    _name = json["name"];
    _email = json["email"];
  }

  Map<String, dynamic> toJson() {
    var map = <String, dynamic>{};
    map["name"] = _name;
    map["email"] = _email;
    return map;
  }

}